<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	$return['item']=$this->plugin_setting('basic');
	if($_RQ['postdata']){
		$postdata=get_postdata();
		if($postdata['type']==0){
			$post=array(
				'sCode'=>trim($postdata['api_sid']),
				'mCode'=>trim($postdata['mobile']),
			);
			$res=$this->model('model')->api_request($return['item']['loginurl'],$post);
		}elseif($postdata['type']==1){
			$post=array(
				'sCode'=>trim($postdata['api_sid']),
				'phone'=>trim($postdata['mobile']),
				'phoneName'=>trim($postdata['phoneName']),
				'packageId'=>trim($postdata['packageId']),
				'oNum'=>'SN202101010000',
				'oPrice'=>18.00,
				'oTime'=>TIMESTAMP,
				'mCode'=>'15018181818',
				'mName'=>'核销员A',
			);
			$res=$this->model('model')->api_request($return['item']['openurl'],$post);
		}
		if($res['ErrorMsg']){
			exi('测试失败！','error');
		}else{
			exi('测试成功！');
		}
	}
	$htmls=array(
		'type'=>'edit',
		'desc'=>'接口测试',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'接口测试',
				'list'=>array(
					array('type'=>'radio','title'=>'接口类型','name'=>'type','options'=>'type'),
					array('type'=>'string','title'=>'门店编号','name'=>'api_sid'),
					array('type'=>'string','title'=>'会员手机号','name'=>'mobile'),
					array('type'=>'string','title'=>'会员名','name'=>'phoneName','show'=>array('type'=>1)),
					array('type'=>'string','title'=>'套餐编号','name'=>'packageId','show'=>array('type'=>1)),
				)
			),
		),
	);
	$return['type']=array('会员登录','会员卡开卡','充值');
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
